// File generated from our OpenAPI spec by Stainless.

package com.metest.api.services.async

import com.metest.api.core.ClientOptions
import com.metest.api.services.async.rest.ActuatorServiceAsync
import com.metest.api.services.async.rest.ActuatorServiceAsyncImpl
import java.util.function.Consumer

class RestServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) :
    RestServiceAsync {

    private val withRawResponse: RestServiceAsync.WithRawResponse by lazy {
        WithRawResponseImpl(clientOptions)
    }

    private val actuator: ActuatorServiceAsync by lazy { ActuatorServiceAsyncImpl(clientOptions) }

    override fun withRawResponse(): RestServiceAsync.WithRawResponse = withRawResponse

    override fun withOptions(modifier: Consumer<ClientOptions.Builder>): RestServiceAsync =
        RestServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())

    override fun actuator(): ActuatorServiceAsync = actuator

    class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
        RestServiceAsync.WithRawResponse {

        private val actuator: ActuatorServiceAsync.WithRawResponse by lazy {
            ActuatorServiceAsyncImpl.WithRawResponseImpl(clientOptions)
        }

        override fun withOptions(
            modifier: Consumer<ClientOptions.Builder>
        ): RestServiceAsync.WithRawResponse =
            RestServiceAsyncImpl.WithRawResponseImpl(
                clientOptions.toBuilder().apply(modifier::accept).build()
            )

        override fun actuator(): ActuatorServiceAsync.WithRawResponse = actuator
    }
}
